const app = getApp();
Component({
  properties: {
    currentPage: {
      type: String,
      value: ''
    }
  },
  data: {
    tabs: [
      {
        name: "首页",
        page: "pages/index/index",
        icon: "/static/tabbar/index.png",
        selectedIcon: "/static/tabbar/indexSel.png"
      },
      {
        name: "岗位",
        page: "pages/jobs/index",
        icon: "/static/tabbar/job.png",
        selectedIcon: "/static/tabbar/jobSel.png"
      },
      {
        name: "企业",
        page: "pages/companies/index",
        icon: "/static/tabbar/company.png",
        selectedIcon: "/static/tabbar/companySel.png"
      },
      {
        name: "政策",
        page: "pages/policies/index",
        icon: "/static/tabbar/policy.png",
        selectedIcon: "/static/tabbar/policySel.png"
      },
      {
        name: "我的",
        page: "pages/profile/index",
        icon: "/static/tabbar/my.png",
        selectedIcon: "/static/tabbar/mySel.png"
      }
    ]
  },
  methods: {
    onTabChange(e) {
      const { cur } = e.currentTarget.dataset;
      wx.switchTab({
        url: `/${cur}`
      });
      wx.reLaunch({
        url: `/${cur}`
      })
    }
  }
});
